/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 *
 * Created on 24/01/2011, 08:59:28
 */

package presentacion.tratamiento_y_practica;

import com.toedter.calendar.IDateEditor;
import hibernate.objeto.EgresoBalanceHidroelectrolitico;
import hibernate.objeto.IngresoBalanceHidroelectrolitico;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Calendar;
import java.util.Date;
import javax.swing.ComboBoxModel;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.SpinnerDateModel;
import logica.CapaLogica;
import logica.validacion.CapaValidacion;
import presentacion.CapaPresentacion;
import presentacion.utilidad.maquetado.Fuente;
import presentacion.utilidad.maquetado.Icono;
import presentacion.utilidad.maquetado.InformeError;

/**
 *
 * @author Gonzalo
 */
public class DatosIngresoEgresoBalanceHidroelectroliticoPanel extends javax.swing.JPanel {

    public DatosIngresoEgresoBalanceHidroelectroliticoPanel(boolean esIngreso,
            IngresoBalanceHidroelectrolitico ingresoBalanceHidroelectrolitico,
            EgresoBalanceHidroelectrolitico egresoBalanceHidroelectrolitico) {
        initComponents();
        setearEventosQueCapturanTeclaEnterYEscape();

        this.esIngreso = esIngreso;
        
        this.ingresoBalanceHidroelectrolitico = 
                ingresoBalanceHidroelectrolitico;
        this.egresoBalanceHidroelectrolitico = 
                egresoBalanceHidroelectrolitico;

        personalizarJDialog();
    }

    /**
     * Setea datos de la ventana.
     *
     */
    private void personalizarJDialog() {
        if (ingresoBalanceHidroelectrolitico != null ||
                egresoBalanceHidroelectrolitico != null) {
            exhibirDatosEnPantalla();
            if(CapaPresentacion.modoVisualizacion) {
                inhabilitarCampos();
            }
        }
        setearCamposSegunIngresoOEgreso(); //Despendiendo de esIngreso o egrso
                                           //se setearán los campos.
        //Seteo los campos derivados en desactivados cargándolos con valores vacíos
        personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
        personalizarCampoAlimentacionEnteral(false);
    }

    /**
     * Segun si es esIngreso o egreso se setean los datos correspondientes.
     */
    private void setearCamposSegunIngresoOEgreso() {
        if (esIngreso) { //Se setea la ventana para para esIngreso
            botonQuitar.setText("Quitar ingreso");
            textoDescriptivo.setText("Ingreso");
            disposicionesCantidad.setVisible(false);
            textoDisposicionesCantidad.setVisible(false);
        } else { //Se setea la ventana para para esIngreso
            botonQuitar.setText("Quitar egreso");
            textoDescriptivo.setText("Egreso");
        }
    }

    /**
     * Valida en conjunto todos los campos. Aquellos que son obligatorios y los
     * que no.
     *
     * @return true si el objeto está listo para cargarse, false en caso
     * contrario
     */
    public boolean validarCampos() {
        boolean esCampoColocacionValido = validarCampoColocacion();

        return esCampoColocacionValido;
    }

   

    /**
     * Valida los campos correspondiente al apartado Colocación.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCampoColocacion() {

        //Manejo de la validación de fecha
        if (!CapaValidacion.validarFecha(
                fechaColocacion.getDate(), null, true)) {
            textoHoraYFechaColocacion.setForeground(
                    Fuente.COLOR_ERROR);
            textoHoraYFechaColocacion.setToolTipText(InformeError.
                    INFORME_ERROR_USO_COMUN_HORA_Y_FECHA);
            return false;
        } else {
            textoHoraYFechaColocacion.setForeground(
                    Fuente.COLOR_NORMAL);
            textoHoraYFechaColocacion.setToolTipText(null);
        }       
        return true;
    }

    /**
     * Permite visualizar los detalles del ingreso o egreso del balance
     * hidroelectrolítico.
     *
     */
    private void exhibirDatosEnPantalla() {
        if (esIngreso) {
            tipo.getModel().setSelectedItem(ingresoBalanceHidroelectrolitico.
                    getTipoIngresoBalanceHidroelectrolitico());
            velocidad.setValue(ingresoBalanceHidroelectrolitico.
                    getVelocidadIngresoBalanceHidroelectrolitico());
            cantidad.setValue(ingresoBalanceHidroelectrolitico.
                    getCantidadIngresoBalanceHidroelectrolitico());
            if (ingresoBalanceHidroelectrolitico.
                    getAlimentacionEnteralIngresoBalanceHidroelectrolitico().
                    equalsIgnoreCase("si")) {
                siAlimentacionEnteral.setSelected(true);
            } else {
                noAlimentacionEnteral.setSelected(true);
            }
            ubicacion.getModel().setSelectedItem(
                    ingresoBalanceHidroelectrolitico.
                    getUbicacionIngresoBalanceHidroelectrolitico());
            String horaEnString = ingresoBalanceHidroelectrolitico.
                    getHoraColocacionIngresoBalanceHidroelectrolitico();
            horaColocacion.getModel().setValue(new Date(0, 0, 0,
                CapaLogica.separarHoras(horaEnString),
                CapaLogica.separarMinutos(horaEnString),
                CapaLogica.separarSegundos(horaEnString)));
            fechaColocacion.setDate(ingresoBalanceHidroelectrolitico.
                    getFechaColocacionIngresoBalanceHidroelectrolitico());
            conclusionesColocacion.setText(ingresoBalanceHidroelectrolitico.
                    getConclusionesColocacionIngresoBalanceHidroelectrolitico());
            conclusionesColocacion.setCaretPosition(0);
            horaEnString = ingresoBalanceHidroelectrolitico.
                    getHoraRemocionIngresoBalanceHidroelectrolitico();
            horaRemocion.getModel().setValue(new Date(0, 0, 0,
                CapaLogica.separarHoras(horaEnString),
                CapaLogica.separarMinutos(horaEnString),
                CapaLogica.separarSegundos(horaEnString)));
            fechaRemocion.setDate(ingresoBalanceHidroelectrolitico.
                    getFechaRemocionIngresoBalanceHidroelectrolitico());
            conclusionesRemocion.setText(ingresoBalanceHidroelectrolitico.
                    getConclusionesRemocionIngresoBalanceHidroelectrolitico());
            conclusionesRemocion.setCaretPosition(0);
        } else {
            tipo.getModel().setSelectedItem(egresoBalanceHidroelectrolitico.
                    getTipoEgresoBalanceHidroelectrolitico());
            velocidad.setValue(egresoBalanceHidroelectrolitico.
                    getVelocidadEgresoBalanceHidroelectrolitico());
            cantidad.setValue(egresoBalanceHidroelectrolitico.
                    getCantidadEgresoBalanceHidroelectrolitico());
            if (egresoBalanceHidroelectrolitico.
                    getAlimentacionEnteralEgresoBalanceHidroelectrolitico().
                    equalsIgnoreCase("si")) {
                siAlimentacionEnteral.setSelected(true);
            } else {
                noAlimentacionEnteral.setSelected(true);
            }
            ubicacion.getModel().setSelectedItem(
                    egresoBalanceHidroelectrolitico.
                    getUbicacionEgresoBalanceHidroelectrolitico());
            disposicionesCantidad.setValue(egresoBalanceHidroelectrolitico.
                    getDispocisionCantidadEgresoBalanceHidroelectrolitico());
            String horaEnString = egresoBalanceHidroelectrolitico.
                    getHoraColocacionEgresoBalanceHidroelectrolitico();
            horaColocacion.getModel().setValue(new Date(0, 0, 0,
                CapaLogica.separarHoras(horaEnString),
                CapaLogica.separarMinutos(horaEnString),
                CapaLogica.separarSegundos(horaEnString)));
            fechaColocacion.setDate(egresoBalanceHidroelectrolitico.
                    getFechaColocacionEgresoBalanceHidroelectrolitico());
            conclusionesColocacion.setText(egresoBalanceHidroelectrolitico.
                    getConclusionesColocacionEgresoBalanceHidroelectrolitico());
            conclusionesColocacion.setCaretPosition(0);
            horaEnString = egresoBalanceHidroelectrolitico.
                    getHoraRemocionEgresoBalanceHidroelectrolitico();
            horaRemocion.getModel().setValue(new Date(0, 0, 0,
                CapaLogica.separarHoras(horaEnString),
                CapaLogica.separarMinutos(horaEnString),
                CapaLogica.separarSegundos(horaEnString)));
            fechaRemocion.setDate(egresoBalanceHidroelectrolitico.
                    getFechaRemocionEgresoBalanceHidroelectrolitico());
            conclusionesRemocion.setText(egresoBalanceHidroelectrolitico.
                    getConclusionesRemocionEgresoBalanceHidroelectrolitico());
            conclusionesRemocion.setCaretPosition(0);
        }

    }

    /**
     * Pone en false la propiedad enabled de todos los campos de esIngreso.
     *
     */
    private void inhabilitarCampos() {
        tipo.setEnabled(false);
        velocidad.setEnabled(false);
        cantidad.setEnabled(false);
        siAlimentacionEnteral.setEnabled(false);
        noAlimentacionEnteral.setEnabled(false);
        ubicacion.setEnabled(false);
        disposicionesCantidad.setEnabled(false);
        horaColocacion.setEnabled(false);
        fechaColocacion.setEnabled(false);
        horaRemocion.setEnabled(false);
        fechaRemocion.setEnabled(false);
        conclusionesColocacion.setEnabled(false);
        conclusionesRemocion.setEnabled(false);
        panelCargaUnicaInferior.setVisible(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelCargaUnicaInferior = new javax.swing.JPanel();
        separadorDeterminacionLaboratorio = new javax.swing.JSeparator();
        botonQuitar = new javax.swing.JButton();
        textoTipo = new javax.swing.JLabel();
        tipo = new javax.swing.JComboBox();
        panelDatosUnidad = new javax.swing.JPanel();
        velocidad = new javax.swing.JSpinner();
        textoVelocidad = new javax.swing.JLabel();
        textoCantidad = new javax.swing.JLabel();
        cantidad = new javax.swing.JSpinner();
        ubicacion = new javax.swing.JComboBox();
        textoUbicacion = new javax.swing.JLabel();
        noAlimentacionEnteral = new javax.swing.JRadioButton();
        siAlimentacionEnteral = new javax.swing.JRadioButton();
        textoAlimentacionEnteral = new javax.swing.JLabel();
        disposicionesCantidad = new javax.swing.JSpinner();
        textoDisposicionesCantidad = new javax.swing.JLabel();
        panelColocacion = new javax.swing.JPanel();
        textoHoraYFechaColocacion = new javax.swing.JLabel();
        SpinnerDateModel spinerModel = new SpinnerDateModel(new Date(0, 0, 0, Calendar.HOUR_OF_DAY, 0, 0), null, null, Calendar.HOUR_OF_DAY);
        horaColocacion = new javax.swing.JSpinner(spinerModel);
        fechaColocacion = new com.toedter.calendar.JDateChooser();
        textoColocacion = new javax.swing.JLabel();
        conclusionesColocacionScrollPane1 = new javax.swing.JScrollPane();
        conclusionesColocacion = new javax.swing.JTextArea();
        textoConclusionesColocacion = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        panelRemocion = new javax.swing.JPanel();
        textoHoraYFechaRemocion = new javax.swing.JLabel();
        spinerModel = new SpinnerDateModel(new Date(0, 0, 0, Calendar.HOUR_OF_DAY, 0, 0), null, null, Calendar.HOUR_OF_DAY);
        horaRemocion = new javax.swing.JSpinner(spinerModel);
        fechaRemocion = new com.toedter.calendar.JDateChooser();
        textoRemocion = new javax.swing.JLabel();
        conclusionesRemocionScrollPane = new javax.swing.JScrollPane();
        conclusionesRemocion = new javax.swing.JTextArea();
        textoConclusionesRemocion = new javax.swing.JLabel();
        textoDescriptivo = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();

        separadorDeterminacionLaboratorio.setPreferredSize(new java.awt.Dimension(797, 2));

        botonQuitar.setFont(Fuente.FUENTE_BOTON_INTERNO);
        botonQuitar.setIcon(Icono.ICONO_16_QUITAR);
        botonQuitar.setMnemonic('q');
        botonQuitar.setText("Quitar");
        botonQuitar.setToolTipText("Quita el análisis agregado");
        botonQuitar.setPreferredSize(new java.awt.Dimension(110, 20));
        botonQuitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonQuitarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelCargaUnicaInferiorLayout = new javax.swing.GroupLayout(panelCargaUnicaInferior);
        panelCargaUnicaInferior.setLayout(panelCargaUnicaInferiorLayout);
        panelCargaUnicaInferiorLayout.setHorizontalGroup(
            panelCargaUnicaInferiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCargaUnicaInferiorLayout.createSequentialGroup()
                .addContainerGap(629, Short.MAX_VALUE)
                .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(separadorDeterminacionLaboratorio, javax.swing.GroupLayout.PREFERRED_SIZE, 806, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        panelCargaUnicaInferiorLayout.setVerticalGroup(
            panelCargaUnicaInferiorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelCargaUnicaInferiorLayout.createSequentialGroup()
                .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(separadorDeterminacionLaboratorio, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        textoTipo.setFont(Fuente.FUENTE_LABEL);
        textoTipo.setForeground(Fuente.COLOR_NORMAL);
        textoTipo.setText("Tipo");
        textoTipo.setPreferredSize(new java.awt.Dimension(48, 20));

        tipo.setFont(Fuente.FUENTE_COMBOBOX);
        tipo.setNextFocusableComponent(velocidad);
        tipo.setPreferredSize(new java.awt.Dimension(99, 20));
        tipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tipoActionPerformed(evt);
            }
        });

        velocidad.setFont(Fuente.FUENTE_TEXTFIELD);
        velocidad.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f)));
        velocidad.setPreferredSize(new java.awt.Dimension(99, 20));

        textoVelocidad.setFont(Fuente.FUENTE_LABEL);
        textoVelocidad.setText("Velocidad (ml/h)");
        textoVelocidad.setPreferredSize(new java.awt.Dimension(233, 20));

        textoCantidad.setFont(Fuente.FUENTE_LABEL);
        textoCantidad.setText("Cantidad (cc.)");
        textoCantidad.setPreferredSize(new java.awt.Dimension(233, 20));

        cantidad.setFont(Fuente.FUENTE_TEXTFIELD);
        cantidad.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f)));
        cantidad.setNextFocusableComponent(siAlimentacionEnteral);
        cantidad.setPreferredSize(new java.awt.Dimension(70, 20));

        ubicacion.setFont(Fuente.FUENTE_COMBOBOX);
        ubicacion.setModel(CapaPresentacion.getListaDeTipoDeUbicacionEnIngresoEgresoBalanceHidroelectrolitico());
        ubicacion.setNextFocusableComponent(disposicionesCantidad);
        ubicacion.setPreferredSize(new java.awt.Dimension(96, 20));

        textoUbicacion.setFont(Fuente.FUENTE_LABEL);
        textoUbicacion.setForeground(Fuente.COLOR_NORMAL);
        textoUbicacion.setText("Ubicación");
        textoUbicacion.setPreferredSize(new java.awt.Dimension(48, 20));

        noAlimentacionEnteral.setFont(Fuente.FUENTE_CHECKBOX);
        noAlimentacionEnteral.setForeground(Fuente.COLOR_NORMAL);
        noAlimentacionEnteral.setText("no");
        noAlimentacionEnteral.setNextFocusableComponent(ubicacion);
        noAlimentacionEnteral.setPreferredSize(new java.awt.Dimension(42, 20));
        noAlimentacionEnteral.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noAlimentacionEnteralActionPerformed(evt);
            }
        });

        siAlimentacionEnteral.setFont(Fuente.FUENTE_CHECKBOX);
        siAlimentacionEnteral.setForeground(Fuente.COLOR_NORMAL);
        siAlimentacionEnteral.setText("si");
        siAlimentacionEnteral.setNextFocusableComponent(noAlimentacionEnteral);
        siAlimentacionEnteral.setPreferredSize(new java.awt.Dimension(42, 20));
        siAlimentacionEnteral.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                siAlimentacionEnteralActionPerformed(evt);
            }
        });

        textoAlimentacionEnteral.setFont(Fuente.FUENTE_TEXTFIELD);
        textoAlimentacionEnteral.setText("Aliment. enteral");
        textoAlimentacionEnteral.setPreferredSize(new java.awt.Dimension(233, 20));

        disposicionesCantidad.setFont(Fuente.FUENTE_TEXTFIELD);
        disposicionesCantidad.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f)));
        disposicionesCantidad.setNextFocusableComponent(horaColocacion);
        disposicionesCantidad.setPreferredSize(new java.awt.Dimension(70, 20));

        textoDisposicionesCantidad.setFont(Fuente.FUENTE_LABEL);
        textoDisposicionesCantidad.setText("Disp., Cant. (cc)");
        textoDisposicionesCantidad.setPreferredSize(new java.awt.Dimension(233, 20));

        javax.swing.GroupLayout panelDatosUnidadLayout = new javax.swing.GroupLayout(panelDatosUnidad);
        panelDatosUnidad.setLayout(panelDatosUnidadLayout);
        panelDatosUnidadLayout.setHorizontalGroup(
            panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosUnidadLayout.createSequentialGroup()
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textoDisposicionesCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(textoUbicacion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(textoVelocidad, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(textoCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(textoAlimentacionEnteral, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelDatosUnidadLayout.createSequentialGroup()
                        .addComponent(siAlimentacionEnteral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(noAlimentacionEnteral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cantidad, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                    .addComponent(ubicacion, javax.swing.GroupLayout.Alignment.LEADING, 0, 122, Short.MAX_VALUE)
                    .addComponent(disposicionesCantidad, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                    .addComponent(velocidad, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)))
        );
        panelDatosUnidadLayout.setVerticalGroup(
            panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosUnidadLayout.createSequentialGroup()
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textoVelocidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(velocidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoAlimentacionEnteral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(noAlimentacionEnteral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(siAlimentacionEnteral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoUbicacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ubicacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelDatosUnidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoDisposicionesCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(disposicionesCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        panelColocacion.setPreferredSize(new java.awt.Dimension(280, 173));

        textoHoraYFechaColocacion.setFont(Fuente.FUENTE_LABEL);
        textoHoraYFechaColocacion.setForeground(Fuente.COLOR_NORMAL);
        textoHoraYFechaColocacion.setText("Hora y fecha");
        textoHoraYFechaColocacion.setPreferredSize(new java.awt.Dimension(95, 20));

        JSpinner.DateEditor horaDeMuerte = new JSpinner.DateEditor(horaColocacion, "HH:mm:ss");
        horaColocacion.setEditor(horaDeMuerte);
        horaColocacion.setFont(Fuente.FUENTE_TEXTFIELD);
        horaColocacion.setMinimumSize(new java.awt.Dimension(137, 20));
        horaColocacion.setPreferredSize(new java.awt.Dimension(66, 20));

        fechaColocacion.setToolTipText("");
        fechaColocacion.setDate(new Date());
        fechaColocacion.setMaxSelectableDate(new Date());
        fechaColocacion.setMinSelectableDate(new java.util.Date(-2208985673000L));
        fechaColocacion.setMinimumSize(new java.awt.Dimension(105, 20));
        fechaColocacion.setPreferredSize(new java.awt.Dimension(79, 20));

        textoColocacion.setText("Colocación");
        textoColocacion.setPreferredSize(new java.awt.Dimension(34, 20));

        conclusionesColocacionScrollPane1.setPreferredSize(new java.awt.Dimension(248, 80));

        conclusionesColocacion.setColumns(15);
        conclusionesColocacion.setFont(Fuente.FUENTE_TEXTFIELD);
        conclusionesColocacion.setRows(4);
        conclusionesColocacion.setNextFocusableComponent(horaRemocion);
        conclusionesColocacionScrollPane1.setViewportView(conclusionesColocacion);

        textoConclusionesColocacion.setFont(Fuente.FUENTE_TEXTFIELD);
        textoConclusionesColocacion.setText("Conclusiones");
        textoConclusionesColocacion.setPreferredSize(new java.awt.Dimension(102, 20));

        javax.swing.GroupLayout panelColocacionLayout = new javax.swing.GroupLayout(panelColocacion);
        panelColocacion.setLayout(panelColocacionLayout);
        panelColocacionLayout.setHorizontalGroup(
            panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(textoColocacion, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
            .addGroup(panelColocacionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textoConclusionesColocacion, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoHoraYFechaColocacion, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelColocacionLayout.createSequentialGroup()
                        .addComponent(horaColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(fechaColocacion, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
                    .addComponent(conclusionesColocacionScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE))
                .addContainerGap())
        );
        panelColocacionLayout.setVerticalGroup(
            panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelColocacionLayout.createSequentialGroup()
                .addComponent(textoColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(horaColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textoHoraYFechaColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(fechaColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelColocacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelColocacionLayout.createSequentialGroup()
                        .addComponent(textoConclusionesColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(93, 93, 93))
                    .addComponent(conclusionesColocacionScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)))
        );

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        panelRemocion.setPreferredSize(new java.awt.Dimension(280, 173));

        textoHoraYFechaRemocion.setFont(Fuente.FUENTE_LABEL);
        textoHoraYFechaRemocion.setForeground(Fuente.COLOR_NORMAL);
        textoHoraYFechaRemocion.setText("Hora y fecha");
        textoHoraYFechaRemocion.setPreferredSize(new java.awt.Dimension(95, 20));

        horaDeMuerte = new JSpinner.DateEditor(horaColocacion, "HH:mm:ss");
        horaRemocion.setEditor(horaDeMuerte);
        horaRemocion.setFont(Fuente.FUENTE_TEXTFIELD);
        horaRemocion.setMinimumSize(new java.awt.Dimension(137, 20));
        horaRemocion.setPreferredSize(new java.awt.Dimension(66, 20));

        fechaRemocion.setToolTipText("");
        fechaRemocion.setDate(new Date());
        fechaRemocion.setMaxSelectableDate(new Date());
        fechaRemocion.setMinSelectableDate(new java.util.Date(-2208985673000L));
        fechaRemocion.setMinimumSize(new java.awt.Dimension(105, 20));
        fechaRemocion.setPreferredSize(new java.awt.Dimension(79, 20));

        textoRemocion.setText("Remoción");
        textoRemocion.setPreferredSize(new java.awt.Dimension(34, 20));

        conclusionesRemocionScrollPane.setPreferredSize(new java.awt.Dimension(248, 80));

        conclusionesRemocion.setColumns(15);
        conclusionesRemocion.setFont(Fuente.FUENTE_TEXTFIELD);
        conclusionesRemocion.setRows(4);
        conclusionesRemocion.setNextFocusableComponent(botonQuitar);
        conclusionesRemocionScrollPane.setViewportView(conclusionesRemocion);

        textoConclusionesRemocion.setFont(Fuente.FUENTE_TEXTFIELD);
        textoConclusionesRemocion.setText("Conclusiones");
        textoConclusionesRemocion.setPreferredSize(new java.awt.Dimension(102, 20));

        javax.swing.GroupLayout panelRemocionLayout = new javax.swing.GroupLayout(panelRemocion);
        panelRemocion.setLayout(panelRemocionLayout);
        panelRemocionLayout.setHorizontalGroup(
            panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(textoRemocion, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
            .addGroup(panelRemocionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textoConclusionesRemocion, 0, 0, Short.MAX_VALUE)
                    .addComponent(textoHoraYFechaRemocion, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRemocionLayout.createSequentialGroup()
                        .addComponent(horaRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(fechaRemocion, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
                    .addComponent(conclusionesRemocionScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE))
                .addContainerGap())
        );
        panelRemocionLayout.setVerticalGroup(
            panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRemocionLayout.createSequentialGroup()
                .addComponent(textoRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(horaRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textoHoraYFechaRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(fechaRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRemocionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRemocionLayout.createSequentialGroup()
                        .addComponent(textoConclusionesRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(93, 93, 93))
                    .addComponent(conclusionesRemocionScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)))
        );

        textoDescriptivo.setText("Texto descripctivo");
        textoDescriptivo.setPreferredSize(new java.awt.Dimension(34, 20));

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(787, 787, 787)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(textoDescriptivo, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE)
                .addGap(46, 46, 46))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelCargaUnicaInferior, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(textoTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tipo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(panelDatosUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(panelColocacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(panelRemocion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(textoDescriptivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textoTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(panelDatosUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                    .addComponent(panelColocacion, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                    .addComponent(panelRemocion, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelCargaUnicaInferior, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        tipo.setModel(CapaPresentacion.getListaDeTipoDeIngresoEgresoBalanceHidroelectrolitico());
    }// </editor-fold>//GEN-END:initComponents

    private void botonQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonQuitarActionPerformed
        JPanel panelPadre = (JPanel) botonQuitar.getParent().
                getParent().getParent();

        panelPadre.remove(botonQuitar.getParent().getParent());
        panelPadre.revalidate();
        panelPadre.repaint();
    }//GEN-LAST:event_botonQuitarActionPerformed

    private void noAlimentacionEnteralActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noAlimentacionEnteralActionPerformed
        if (noAlimentacionEnteral.isSelected()) {
            siAlimentacionEnteral.setSelected(false);
        }
}//GEN-LAST:event_noAlimentacionEnteralActionPerformed

    private void siAlimentacionEnteralActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_siAlimentacionEnteralActionPerformed
        if (siAlimentacionEnteral.isSelected()) {
            noAlimentacionEnteral.setSelected(false);
        }
}//GEN-LAST:event_siAlimentacionEnteralActionPerformed

    private void tipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tipoActionPerformed
        if (tipo.getSelectedItem().toString().equalsIgnoreCase("arterial")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("swan")) {
            personalizarCampoUbicacion(true, CapaPresentacion.
                    getListaDeTipoDeUbicacionEnIngresoEgresoBalanceHidroelectrolitico());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("central")) {
            personalizarCampoUbicacion(true, CapaPresentacion.
                    getListaDeTipoDeUbicacionEnIngresoEgresoBalanceHidroelectrolitico());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("acceso periférico")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("sonda vesical")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("sonda nasogástrica")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(true);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("sonda nasoenteral")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        } else if (tipo.getSelectedItem().toString().equalsIgnoreCase("sonda nasoyeyunal")) {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        } else {
            personalizarCampoUbicacion(false, CapaPresentacion.getListaVacia());
            personalizarCampoAlimentacionEnteral(false);
        }
    }//GEN-LAST:event_tipoActionPerformed

    public String getTipo() {
        return tipo.getSelectedItem().toString();
    }
    
    public Float getVelocidad() {
        return (Float) velocidad.getValue();
    }
    
    public Float getCantidad() {
        return (Float) cantidad.getValue();
    }
    
    public String getAlimentacionEnteral() {
        if (siAlimentacionEnteral.isSelected()) {
            return "si";
        } else {
            return "no";
        }
    }
    
    public String getUbicacion() {
        return ubicacion.getSelectedItem().toString();
    }
    
    public Float getDispCant() {
        if (disposicionesCantidad.isVisible()) {
            return (Float) disposicionesCantidad.getValue();
        } else {
            return null;
        }
    }
    
    public String getHoraColocacion() {
        return CapaLogica.separarTiempo(
                horaColocacion.getValue().toString());
    }
    
    public Date getFechaColocacion() {
        return fechaColocacion.getDate();
    }
    
    public String getConclusionesColocacion() {
        return conclusionesColocacion.getText();
    }

    public String getHoraRemocion() {
        return CapaLogica.separarTiempo(
                horaRemocion.getValue().toString());
    }

    public Date getFechaRemocion() {
        return fechaRemocion.getDate();
    }

    public String getConclusionesRemocion() {
        return conclusionesRemocion.getText();
    }
     /**
     * Personaliza el campo ubicación con su respectivo llenado de combo, de acuerdo
     * al estado
     * @param estado
     * @param comboBox
     */
    private void personalizarCampoUbicacion(
            boolean estado, ComboBoxModel comboBox) {
        ubicacion.setEnabled(estado);
            ubicacion.setModel(comboBox);
    }

    /**
     * Personaliza los campos alimentación enteral, de acuerdo
     * al estado
     * @param estado
     */
    private void personalizarCampoAlimentacionEnteral(
            boolean estado) {
        siAlimentacionEnteral.setEnabled(estado);
        noAlimentacionEnteral.setEnabled(estado);
        //Siempre se resea la seleccion del campo
        siAlimentacionEnteral.setSelected(false);
        noAlimentacionEnteral.setSelected(false);
    }

    /**
     * Setea en cada componente del JDialog los eventos que capturarán la tecla
     * enter y escape.
     */
    private void setearEventosQueCapturanTeclaEnterYEscape() {
        //Declaración del evento a capturar
        KeyListener keyListenerEscape = new KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    cerrarVentana();
                }
            }
        };

        //Setear eventos
        tipo.addKeyListener(keyListenerEscape);
        ((IDateEditor) fechaColocacion.getDateEditor()).
                getUiComponent().addKeyListener(keyListenerEscape);
        siAlimentacionEnteral.addKeyListener(keyListenerEscape);
        noAlimentacionEnteral.addKeyListener(keyListenerEscape);
        conclusionesColocacion.addKeyListener(keyListenerEscape);
        conclusionesRemocion.addKeyListener(keyListenerEscape);
        botonQuitar.addKeyListener(keyListenerEscape);
        ((IDateEditor) fechaRemocion.getDateEditor()).
                getUiComponent().addKeyListener(keyListenerEscape);
        ((DefaultEditor) horaColocacion.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) horaRemocion.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) velocidad.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) cantidad.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) disposicionesCantidad.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
    }

    private void cerrarVentana() {
        JDialog jdialog = (JDialog)
                this.getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().getParent();
        jdialog.dispose();
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonQuitar;
    private javax.swing.JSpinner cantidad;
    private javax.swing.JTextArea conclusionesColocacion;
    private javax.swing.JScrollPane conclusionesColocacionScrollPane1;
    private javax.swing.JTextArea conclusionesRemocion;
    private javax.swing.JScrollPane conclusionesRemocionScrollPane;
    private javax.swing.JSpinner disposicionesCantidad;
    private com.toedter.calendar.JDateChooser fechaColocacion;
    private com.toedter.calendar.JDateChooser fechaRemocion;
    private javax.swing.JSpinner horaColocacion;
    private javax.swing.JSpinner horaRemocion;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JRadioButton noAlimentacionEnteral;
    private javax.swing.JPanel panelCargaUnicaInferior;
    private javax.swing.JPanel panelColocacion;
    private javax.swing.JPanel panelDatosUnidad;
    private javax.swing.JPanel panelRemocion;
    private javax.swing.JSeparator separadorDeterminacionLaboratorio;
    private javax.swing.JRadioButton siAlimentacionEnteral;
    private javax.swing.JLabel textoAlimentacionEnteral;
    private javax.swing.JLabel textoCantidad;
    private javax.swing.JLabel textoColocacion;
    private javax.swing.JLabel textoConclusionesColocacion;
    private javax.swing.JLabel textoConclusionesRemocion;
    private javax.swing.JLabel textoDescriptivo;
    private javax.swing.JLabel textoDisposicionesCantidad;
    private javax.swing.JLabel textoHoraYFechaColocacion;
    private javax.swing.JLabel textoHoraYFechaRemocion;
    private javax.swing.JLabel textoRemocion;
    private javax.swing.JLabel textoTipo;
    private javax.swing.JLabel textoUbicacion;
    private javax.swing.JLabel textoVelocidad;
    private javax.swing.JComboBox tipo;
    private javax.swing.JComboBox ubicacion;
    private javax.swing.JSpinner velocidad;
    // End of variables declaration//GEN-END:variables
    private IngresoBalanceHidroelectrolitico ingresoBalanceHidroelectrolitico;
    private EgresoBalanceHidroelectrolitico egresoBalanceHidroelectrolitico;
    boolean esIngreso;
}
